
#include "Error.h"

using namespace ttgLib;

//-------------
//--- Error ---
//-------------

Error::Error(const char *errorName,
			 const char *position,
			 const char *description,
			 Error *innerError)
{
	//Generating message.
	if (errorName != NULL)
		_message.append(errorName);
	else
		_message.append("Error");
	if (position != NULL)
	{
		_message.append(" at ");
		_message.append(position);
	}
	if (description != NULL)
	{
		_message.append(": ");
		_message.append(description);
	}
	//Storing error trace.
	if (innerError != NULL)
	{
		_innerErrors = innerError->_innerErrors;
		_innerErrors.push_back(innerError->ToString());
	}
}